using UnityEngine;
using System.Collections;

public class SceneLanguage : AndroidMenu 
{
	void Start()
	{
		base._manager = gameObject.GetComponent<MenuManager>();
		base.amount = _manager.amount;
		
		gameObject.AddComponent("InputManager");
	}

	void OnTouchOver(GameObject go)
	{
		if(!go.GetComponent<SpecialCube>() && ready)
			go.AddComponent("SpecialCube");
	}
	
	void OnTouchExit(GameObject go)
	{
		if(go.GetComponent<SpecialCube>() && ready)
			Destroy(go.GetComponent<SpecialCube>());
		
		go.renderer.material.color = Color.white;
	}
	
	void OnTouchUp(GameObject go)
	{
		if(ready)
		{
			switch(go.name)
			{
				case "Portugues":	
					PlayerPrefs.SetInt("HasChangeLanguage",1);
					PlayerPrefs.SetString("Language","Portugues");
					break;
				 	
				case "English":	
					PlayerPrefs.SetInt("HasChangeLanguage",1);
					PlayerPrefs.SetString("Language","English");
					break;
			}
			
			base._manager.changeSceneAtName("MainMenu");
		}
	}
	
	void Ready()
	{
		ready = true;
	}
}
	